home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1987 November
/
1987-11.d64
/
fraction pract.2
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
6KB
|
190 lines
10 rem copyright 1987 compute! publications, inc. - all rights reserved
20 if peek(65530)=5 then (NULL) 15
30 ba=53281:bo=53280:if peek(65530)=164 then ba=65301:bo=65305
40 x=rnd(-ti):deffnc(z1)=int(15*rnd(1))+1
50 pokeba,1:pokebo,0:printchr$(142)
60 print"[147] copyright 1987 compute! pub., inc."
70 printtab(10)"all rights reserved"
80 printtab(9)"fraction practice ii[146]"
90 printtab(9)"which operation?"
100 printtab(9)"1 = multiplication"
110 printtab(9)"2 = division ";
120 inputm:ifm<1orm>2then60
130 p=0:ti$="000000":print"[147]":pokeba,4:pokebo,7+5*16
140 cc=0:n=0:x=fnc(z1):y=fnc(z1):if x=y then140
150 a=fnc(z1):if a=x or a=y then150
160 b=fnc(z1):if b=a or b=x or b=y then160
170 p=p+1:if p>20 then1640
180 if m=2 then gosub1330
190 gosub1750
200 print"simplify which numbers?"
210 print"(if none, type 1)
220 [133] s1:[139] s1[178]1 [167]810
230 [139] s1[178]e [167]190
240 [139] s1[178]x [167][153]""[163]2)" cmdcmdcmd"x"wait":[137]290
250 [139] s1[178]y [167][153]""[163]2)" cmdcmdcmd"y"wait":[137]290
260 [139] s1[178]a [167][153]""[163]12)" cmdcmdcmd"a"wait":[137]290
270 [139] s1[178]b [167][153]""[163]12)" cmdcmdcmd"b"wait":[137]290
280 [153]"there isn't a";s1:s1[178]0:[141]1720:[137]190
290 [133] s2:[139] s2[178]e [167]190
300 [139] s2[178]b [167][153]""[163]12)" cmdcmdcmd"b"wait":[137]350
310 [139] s2[178]a [167][153]""[163]12)" cmdcmdcmd"a"wait":[137]350
320 [139] s2[178]y [167][153]""[163]2)" cmdcmdcmd"y"wait":[137]350
330 [139] s2[178]x [167][153]""[163]2)" cmdcmdcmd"x"wait":[137]350
340 [153]"there isn't a";s2:s2[178]0:[141]1720:[137]190
350 [139] (c[177]0 [175] s1[178]s2) [176] s1[179][177]s2 [167]370
360 [153]"only one "s1" can be used here":s1[178]0:s2[178]0:[141]1720:[137]190
370 [139] s1[178]x [176] s1[178]a [167]390
380 [139] s1[178]y [176] s1[178]b [167]410
390 [139] s2[178]y [176] s2[178]b [167]460
400 [137]420
410 [139] s2[178]x [176] s2[178]a [167]460
420 [139] s1[178]s2 [167]360
430 [153]"you can't simplify two numerators or "
440 [153]"two denominators"
450 s1[178]0:s2[178]0:[141]1720:[137]190
460 [139] s1[177]s2 [167] d[178]s1:[137]480
470 d[178]s2
480 [129] c[178]d [164] 2 [169] [171]1
490 [139] s1[173]c[178][181](s1[173]c) [175] s2[173]c[178][181](s2[173]c) [167]530
500 [130] c
510 [153]"can't simplify those numbers":[141]1720
520 s1[178]0:s2[178]0:[137]190
530 [153]"what is the largest number that can"
540 [153]"divide both"s1"and"s2"?"
550 [133] c1:[139] c1[178]e [167]190
560 [139]c1[179]c[167][153]"try a larger numberononononononon":[137]530
570 [139]c1[177]c[167][153]"too large ononononononon":[137]530
580 [153]" "
590 [153]s1"divided by"c1" = ";
600 [133] c2:[139] c2[178]e [167]190
610 [139] c2[178]s1[173]c1 [167]630
620 [153]"incorrect...onononon ":[137]580
630 [153]" "
640 [139] s1[178]x [167] x[178]s1[173]c1:[153]" "x;"cmd ":[137]680
650 [139] s1[178]a [167] a[178]s1[173]c1:[153]" "[163]11)a;"cmd ":[137]680
660 [139] s1[178]y [167] y[178]s1[173]c1:[153]" "y;"cmd ":[137]680
670 [139] s1[178]b [167] b[178]s1[173]c1:[153]""[163]11)s1[173]c1;"cmd "
680 [153]s2"divided by"c1" = ";
690 [133] c3:[139] c3[178]e [167]680
700 [139] c3[178]s2[173]c1 [167] [153]" ":[137]720
710 [153]"incorrect...ononon":[137]630
720 [139] s2[178]b [167] b[178]s2[173]c1:[153]""[163]11)b;"cmd ":[137]760
730 [139] s2[178]y [167] y[178]s2[173]c1:[153]" "y;"cmd ":[137]760
740 [139] s2[178]a [167] a[178]s2[173]c1:[153]" "[163]11)a;"cmd ":[137]760
750 [139] s2[178]x [167] x[178]s2[173]c1:[153]" "x;"cmd "
760 [153]"good job! press any key...
770 get bb$:if bb$=""then770
780 cc=cc+1
790 gosub1750
800 goto200
810 gosub1750
820 print" "
830 print"your answer is..."
840 printtab(4)"[195][195][195][145][157][157][157]"
850 print"[145]"tab(3);:input n1:if n1=e then190
860 print"[145]"tab(2)" "n1"[157] "
870 printtab(5)"[195][195]"
880 printtab(3);:input d1:if d1=e then190
890 print"[145]"tab(2)" "d1"[157] "
900 if n1=x*a then920
910 print"wrong numerator... [145][145][145][145][145][145][145][145]":goto830
920 if d1=y*b then940
930 print"wrong denominator...[145][145][145][145][145][145][145][145]":goto830
940 ifn1<d1 then n2=n1:d2=d1:goto1160
950 ifn1/d1<>int(n1/d1)then980
960 print"please change to a whole number...":printtab(7)"[145][145][145][145] =";:input w
970 goto990
980 print"please change to a mixed number...":printtab(7)"[145][145][145][145] =";:input w
990 if w=int(n1/d1) then1020
1000 if w=e then190
1010 print"incorrect...[145][145][145][145][157][157]"w"[157] ":printtab(9)"[145]";:inputw:goto990
1020 w$=str$(w):a$=left$(w$,2):l=val(a$):n=11:gosub1790
1030 if w<10 then1070
1040 a$=mid$(w$,3,1):l=val(a$):n=16:gosub1790
1050 if w<100 then1070
1060 a$=mid$(w$,4,1):l=val(a$):n=21:gosub1790
1070 n=n+4:if int(n1/d1)=n1/d1 then print"":goto1280
1080 print"[145]"tab(n);:input"[145]";n2
1090 if n2=e then190
1100 print"[145]"tab(n)" "n2"[157] ":printtab(n+2)"[195][195]":printtab(n);
1110 input d2:print"[145]"tab(n)" "d2"[157] "
1120 if d2=e then190
1130 if n2=n1-(w*d1)then1150
1140 print"wrong numerator... [145][145][145][145]": goto1080
1150 if d2<>d1 thenprint"wrong denominator...[145][145][145][145]":goto1080
1160 for g=b*y to 2 step -1
1170 ifn2/g=int(n2/g)andd2/g=int(d2/g)thenprinttab(8)"[145][145]= ":goto1190
1180 next g:goto1280
1190 if n=0 then n=10
1200 print"please simplify... [145][145][145][145]":printtab(n+2)"[195][195][145][145]"
1210 printtab(n);:input s4:print"[145]"tab(n-1)" "s4"[157] "
1220 if s4=e then190
1230 print""tab(n);:input t2
1240 if t2=e then190
1250 print"[145]"tab(n-1)" "t2"[157] "
1260 if s4=n2/g and t2=d2/g then1280
1270 print"incorrect...please simplify again [145][145][145][145][145][145]":goto1210
1280 fors=1to3:print" ":nexts
1290 print"well done![146]"
1300 t=ti+150
1310 ift>tithen1310
1320 goto140
1330 print"[147]this is problem number";p;"[157]."
1340 print" "xtab(7)"[209]"tab(11)b
1350 print" [195][195][195] [195][195][195] [195][195][195] ="
1360 print" "ytab(7)"[209]"tab(11)a
1370 print"please rewrite the problem correctly
1380 [153]" lenlenlen lenlenlen"
1390 [133]"";x1
1400 [139] x1[178]e [167]1330
1410 [153]" "x1"cmd "
1420 [139] x1[179][177]x [167][153]"incorrect...":[137]1390
1430 [153]" "
1440 [133]"";y1
1450 [139] y1[178]e [167]1330
1460 [153]" "y1"cmd "
1470 [139] y1[179][177]y [167][153]"incorrect...":[137]1440
1480 [153]" "
1490 [153]""[163]5);:[133] o$
1500 o$[178][200](o$,1):[139] o$[178]"e" [167]1330
1510 [153]"on"[163]5)" "o$" "
1520 [139] o$[179][177]"*" [167] [153]"please use stop* for multiplication...":[137]1490
1530 [153]""[163]10);:[133] a1
1540 [139] a1[178]e [167]1330
1550 [153]""[163]9)" "a1"cmd "
1560 [139] a1[179][177]a [167] [153]"incorrect... ":[137]1530
1570 [153]" "
1580 [153]""[163]10);
1590 [133] b1:[139] b1[178]e [167]1330
1600 [153]""[163]9)" "b1"cmd "
1610 [139] b1[179][177]b [167] [153]"incorrect...":[137]1580
1620 [141]1720
1630 [142]
1640 [153]"load this set of problems took you
1650 print" "left$(ti$,2)" hours, ";
1660 printmid$(ti$,3,2)" minutes and "right$(ti$,2)" seconds!
1670 [139] ti$[179]"002000" [167] [153]" good job!wait":[137]1690
1680 [153]" it takes practice"
1690 [153]" more problems (y/n)";:[133] q$
1700 [139] [200](q$,1)[179][177]"y"[167] [153]"load":[128]
1710 [137]50
1720 [153]"press any key...
1730 get aa$:if aa$="" then1730
1740 return
1750 print"[147]this is problem #";p;"[157]."
1760 print" "xtab(11)a
1770 print" [195][195][195] * [195][195][195] ="
1